Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicit namespaces in sort-related docstrings #53968

Merged
merged 3 commits into from
Apr 6, 2024

Conversation

jishnub
Copy link
Contributor

@jishnub jishnub commented Apr 5, 2024

This represents the unexported names by the fully qualified namespace, which makes it simpler to interpret the keyword arguments. Otherwise, for example, it's not obvious where Forward comes from in the sort docstring.

Also, replaces some occurrences of instance <: Algorithm by instance isa Algorithm, which is the correct relation. This is also closer to English, which helps with readability.

Additionally, I think Base.Sort.defalg should be documented, as this is being used in the function signatures. This may be done separately.

@jishnub jishnub added docs This change adds or pertains to documentation sorting Put things in order labels Apr 5, 2024
@jishnub jishnub requested a review from LilithHafner April 5, 2024 19:18
Copy link
Member

@LilithHafner LilithHafner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These seem like improvements

Changing CountingSort <: Algorithm to CountingSort() isa Algorithm would not be an improvement on its own, as the declaration of Counting sort is literally struct CountingSort <: Algorithm end, but I guess it makes sense for consistency.

This also documents the internals from a Base user's perspective which, absent the public keyword, would be a problem, but with that it's clear these are not public so it's okay to document them in a way that focuses on the experience of Base users poking around.

Overall, LGTM. Thanks!

base/sort.jl Outdated Show resolved Hide resolved
base/sort.jl Outdated Show resolved Hide resolved
jishnub and others added 2 commits April 6, 2024 09:50
@jishnub
Copy link
Contributor Author

jishnub commented Apr 6, 2024

Personally I don't prefer the CountingSort() isa Algorithm over the current style either, but I did indeed change this for consistency. I suppose this form makes it clear that the constructor doesn't take any argument.

@LilithHafner LilithHafner merged commit c707a53 into master Apr 6, 2024
5 of 7 checks passed
@LilithHafner LilithHafner deleted the jishnub/sortdocstrings branch April 6, 2024 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This change adds or pertains to documentation sorting Put things in order
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants